Semiconductor device

ABSTRACT

There is a need to cause a delay to occur less frequently than the related art during processing of an input signal in need of relatively fast processing. In a semiconductor device, a conversion portion includes first channels and second channels and A/D converts a signal input to a selected channel. A signal input to the first channel requires faster processing than a signal input to the second channel. The conversion portion receives a scan conversion instruction from a central processing unit, sequentially selects the input channels in a specified selection order, and successively performs A/D conversion. In this case, the conversion portion notifies a peripheral circuit of completion of A/D conversion after completion of A/D conversion on signals input to the first channels and before completion of A/D conversion on input signals input to all input channels.

CROSS-REFERENCE TO RELATED APPLICATIONS

The disclosure of Japanese Patent Application No. 2010-284393 filed onDec. 21, 2010 including the specification, drawings and abstract isincorporated herein by reference in its entirety.

BACKGROUND

The present invention relates to a semiconductor device having ananalog-digital converter.

An A/D converter performs analog-to-digital conversion on an analogsignal input from plural channels by switching the channels. In manycases, the A/D converter is supplied with a mix of a signal requiringhigh-speed processing and a signal requiring low-speed processing. Insuch a case, a processing delay might occur, that is, the A/D conversionmight be uncompleted for a signal requiring high-speed processing by thespecified time.

For example, Japanese Unexamined Patent Publication No. 2010-41152(patent document 1) discloses the technology of decreasing processingdelays. According to the technology described in this document, an A/Dconverter is set to start for a channel and then an asynchronous A/Dconversion request might occur for a channel different from the alreadyset channel before the A/D converter starts for that channel. In such acase, the A/D converter is reset to start so that the A/D conversionwill start after a lapse of specified time in consideration of the timeto perform the A/D conversion on plural channels that requested the A/Dconversion.

Patent Document 1: Japanese Unexamined Patent Publication No. 2010-41152

SUMMARY

Generally, an A/D converter having plural input channels provides a scanconversion mode that successively selects the input channels andcontinuously A/D converts input signals to all the channels. In thiscase, a register temporarily stores A/D conversion results of all thechannels. After a sequence of A/D conversion is completed, a CPU(central processing unit) is interrupted to read data stored in theregister.

According to this method, however, data after the A/D conversion cannotbe processed until the A/D conversion is completed for all the channels.A processing delay might occur for signals requiring high-speedprocessing.

The present invention has been made in consideration of the foregoing.It is therefore an object of the invention to cause a delay to occurless frequently than the related art during processing of an inputsignal in need of relatively fast processing on a semiconductor devicehaving an A/D converter that scans and converts signals input to pluralchannels.

A semiconductor device according to an embodiment of the inventionincludes: a central processing unit; plural peripheral circuitsincluding first and second peripheral circuits; and a conversionportion. The conversion portion has plural input channels including oneor more first channels and one or more second channels, selects one ofthe input channels, and A/D converts a signal input to a selected inputchannel. Signal processing in the first peripheral circuit uses an A/Dconversion result on a signal input to the one or more first channels.Signal processing in the second peripheral circuit uses an A/Dconversion result on a signal input to the one or more second channels.A signal input to the one or more first channels requires fasterprocessing than a signal input to the one or more second channels. Theconversion portion receives a scan conversion instruction from thecentral processing unit or the peripheral circuits, sequentially selectsthe input channels in accordance with a specified selection order, andsuccessively performs A/D conversion. The conversion portion receivesthe scan conversion instruction, notifies the first peripheral circuitof completion of A/D conversion after completion of A/D conversion on asignal input to the one or more first channels and before completion ofA/D conversion on input signals input to all input channels, andnotifies the second peripheral circuit of completion of A/D conversionafter completion of A/D conversion on input signals input to all inputchannels.

The above-mentioned embodiment can cause a delay to occur lessfrequently than the related art during processing of an input signalthat is input to one or more first channels and requires relatively fastprocessing.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing a configuration of a microcontroller100 according to a first embodiment of the invention;

FIG. 2 is a timing chart showing operations of the microcontroller 100in FIG. 1;

FIG. 3 is a block diagram showing a configuration of a microcontroller100A according to a modification of the first embodiment of theinvention;

FIG. 4 is a timing chart showing operations of the microcontroller 100Ain FIG. 3;

FIG. 5 is a block diagram showing a configuration of a microcontroller100B according to a second embodiment of the invention;

FIG. 6 is a timing chart showing operations of the microcontroller 100Bin FIG. 5;

FIG. 7 is a block diagram showing a configuration of a microcontroller100C according to a third embodiment of the invention; and

FIG. 8 is a timing chart showing operations of the microcontroller 100Cin FIG. 7.

DETAILED DESCRIPTION

Embodiments of the present invention will be described in further detailwith reference to the accompanying drawings. The mutually correspondingparts or equivalents in the embodiments are designated by the samereference numerals and a description is omitted for simplicity.

First Embodiment

FIG. 1 is a block diagram showing a configuration of a microcontroller100 according to a first embodiment of the invention.

FIG. 1 shows an example of using the microcontroller 100 to control athree-phase synchronous motor. The microcontroller 100 has inputterminals T0 through T5. The input terminals T0 through T2 are coupledto a synchronous motor 101 and are supplied with detection signals formotor currents corresponding to respective phases. The input terminal T3and T4 are coupled to temperature sensors 102 and 103, respectively, andare supplied with detection signals from the temperature sensors 102 and103. The temperature sensors 102 and 103 detect the temperature of aswitching element provided for an inverter circuit or detect thetemperature of an armature winding wire for the synchronous motor, forexample. The input terminal T5 is coupled to a fan motor 104 and issupplied with a detection value as the drive voltage for the fan motor104. Detection signals for motor currents supplied to the inputterminals T0 through T2 are used for feedback control of the synchronousmotor and need to be processed faster than detection signals for thetemperature sensors or a detection signal for the fan motor 104 as amotor voltage.

As shown in FIG. 1, the microcontroller (semiconductor device) 100includes a CPU 1, a conversion portion 2, peripheral circuits IP0, IP1,and IP2, an interrupt control circuit 3, a DMA control circuit 4, and acommon bus 5. The CPU 1, the conversion portion 2, the peripheralcircuits IP0, IP1, and IP2, and the DMA control circuit 4 are coupled toeach other through the common bus 5.

The CPU 1 operates in accordance with a program stored in a memorycircuit (not shown) and controls the entire operation of themicrocontroller 100.

The conversion portion 2 includes plural input channels CH0 through CH5(also generically referred to as an input channel CH) and A/D convertsan input signal supplied to the one selected input channel in accordancewith a request from the CPU 1 or the peripheral circuits IP0 throughIP2. The conversion portion 2 uses a scan conversion mode as anoperation mode to sequentially select the input channels CH0 and CH5 inthis order and successively A/D convert input signals corresponding toall the channels.

According to the first embodiment, the input channels CH0 through CH2are supplied with detection signals that require relatively fastprocessing for motor currents corresponding to the phases. The inputchannels CH3 and CH4 are supplied with detection signals from thetemperature sensors 102 and 103. The input channel CH5 is supplied witha detection signal from the fan motor 104 as a motor voltage.

The conversion portion 2 includes a channel selection portion 11, an A/Dconverter 12, and a register group 13. The channel selection portion 11selects one of signals supplied to the input channels CH0 through CH5 inaccordance with a selection signal SEL received from the A/D converter12 and outputs the selected signal. The first embodiment assumes theselection signal SEL to be a 6-bit signal whose bit signals correspondto the input channels CH of the conversion portion 2. Each input channelCH is selected if the corresponding bit signal goes to the H level.

The A/D converter 12 generates the selection signal SEL and A/D convertsa signal that is output from the channel selection portion 11 inresponse to the selection signal SEL. The register group 13 includesdata registers RA0 through RA5 (also generically referred to as a dataregister RA) corresponding to the input channels CH0 through CH5. Eachdata register RA stores an A/D conversion result for a signal input tothe corresponding input channel CH.

The peripheral circuit IP0 processes signals using an A/D conversionresult of a detection signal for motor currents supplied to the inputchannels CH0 through CH2. The peripheral circuit IP0 is coupled to thedata registers RA0 through RA2 corresponding to the input channels CH0through CH2 through a dedicated line and is capable of reading A/Dconversion results stored in the data registers RA0 through RA2 withoutusing the CPU 1.

The peripheral circuit IP0 is supplied with some bit signals out of theselection signal SEL generated from the A/D converter 12. As will bedescribed in FIG. 2, the selection signal SEL notifies completion of theA/D conversion. Using the selection signal SEL, the peripheral circuitIP0 can acknowledge completion of A/D conversion of input signalssupplied to the input channels CH0 through CH2 before the conversionportion 2 performs scan conversion and completes A/D conversion of allinput signals.

The peripheral circuit IP1 performs signal processing using A/Dconversion results of detection signals supplied to the input channelsCH3 and CH4 from the temperature sensors 102 and 103. As shown in FIG.1, the peripheral circuit IP1 is coupled to the data registers RA3 andRA4 through a dedicated line and is capable of reading A/D conversionresults stored in the data registers RA3 and RA4 without using the CPU1. This coupling method of using the dedicated line necessitates an areafor wiring the dedicated line. On the other hand, high-speed processingis unnecessary for detection signals from the temperature sensors 102and 103. It may be preferable to transfer A/D conversion results storedin the data registers RA3 and RA4 to the peripheral circuit IP1 throughthe common bus 5 and the CPU 1 without using the dedicated line.

The peripheral circuit IP2 performs signal processing using a detectionsignal supplied to the input channel CH5 as a motor voltage of the fanmotor 104. As shown in FIG. 1, the peripheral circuit IP2 is coupled tothe data register RA5 through a dedicated line and is capable of readingA/D conversion results stored in the data register RA5 without using theCPU 1. Similarly to the peripheral circuit IP1, high-speed processing isunnecessary for detection signals as motor voltages of the fan motor104. It may be preferable to transfer A/D conversion results stored inthe data register RA5 to the peripheral circuit IP2 through the commonbus 5 and the CPU 1 without using the dedicated line.

The interrupt control circuit 3 controls an interrupt operation thatinterrupts active processing in the CPU 1 and performs more highlyprioritized processing. The interrupt control circuit 3 notifies the CPU1 of an interrupt occurrence in response to an interrupt request issuedfrom the conversion portion 2 or the peripheral circuit. If theconversion portion 2 performs scan conversion and completes the A/Dconversion of all input signals, the interrupt control circuit 3receives a completion notification signal CMP notifying completion ofthe A/D conversion from the conversion portion 2 and outputs aninterrupt signal to the CPU 1.

The DMA control circuit 4 controls DMA (Direct Memory Access) transferthat transfers data without the CPU 1. The CPU 1 might receive aninterrupt control signal from the interrupt control circuit 3 aftercompletion of the scan conversion. In this case, the CPU 1 instructs theDMA control circuit 4 to transfer A/D conversion results to theperipheral circuits IP1 and IP2. The peripheral circuits IP1 and IP2receive a control signal from the DMA control circuit 4 and acknowledgecompletion of the A/D conversion. The A/D conversion results stored inthe data registers RA3 and RA4 are transferred to the peripheral circuitIP1 through the dedicated line. An A/D conversion result stored in thedata register RA5 is transferred to the peripheral circuit IP2 throughthe dedicated line.

FIG. 2 is a timing chart showing operations of the microcontroller 100in FIG. 1. FIG. 2 shows operations of the conversion portion 2 in FIG. 1when it receives a scan conversion instruction from the CPU 1 or any ofthe peripheral circuits IP0 through IP2. FIG. 2 shows, from the top tothe bottom, bit waveforms of the selection signal SEL for selecting theinput channels CH0 through CH5, a waveform of the completionnotification signal CMP, and operations (writing (W) or reading (R)) ofthe data registers RA0 through RA5.

With reference to FIGS. 1 and 2, the input channel CH0 is selected fromtime t1 to time t2 and an A/D conversion result of the signal input tothe input channel CH0 is written to the data register RA0. The inputchannel CH1 is selected from time t3 to time t4 and an A/D conversionresult of the signal input to the input channel CH1 is written to thedata register RA1. The input channel CH2 is selected from time t5 totime t6 and an A/D conversion result of the signal input to the inputchannel CH2 is written to the data register RA2. The input channel CH3is selected from time t7 to time t9 and an A/D conversion result of thesignal input to the input channel CH3 is written to the data registerRA3. The input channel CH4 is selected from time t10 to time t11 and anA/D conversion result of the signal input to the input channel CH4 iswritten to the data register RA4. The input channel CH5 is selected fromtime t12 to time t13 and an A/D conversion result of the signal input tothe input channel CH5 is written to the data register RA5.

The peripheral circuit IP0 receives a bit signal SEL (CH3) for selectingthe input channel CH3 out of the selection signal SEL from the A/Dconverter 12. The input channel CH3 is configured to be selected next tothe input channel CH2 out of the input channels CH0 through CH2 relatedto the peripheral circuit IP0. The peripheral circuit IP0 detects thetiming to set the input channel CH3 to the H level at time t7, that is,the timing to start selecting the input channel CH3, from the bit signalSEL (CH3). This signifies that the peripheral circuit IP0 is notified ofcompletion of the A/D conversion for signals input to the input channelsCH0 through CH2 from the conversion portion 2.

At time t8 after receiving the notification of completion of the A/Dconversion, the peripheral circuit IP0 starts reading A/D conversionresults stored in the data registers RA0 through RA2.

At time t14 after completion of the A/D conversion for input signalssupplied to all the input channels, the A/D converter 12 outputs thecompletion notification signal CMP indicating completion of the A/Dconversion to the interrupt control circuit 3. The CPU 1 receives theinterrupt control signal from the interrupt control circuit 3 andinstructs the DMA control circuit 4 to transfer A/D conversion results.At time t15, the DMA control circuit 4 starts transferring A/Dconversion results from the data register RA3 through RA5 to theperipheral circuits IP1 and IP2.

As mentioned above, the microcontroller 100 according to the firstembodiment uses the selection signal SEL to notify the peripheralcircuit IP0 of completion of the A/D conversion. Accordingly, theperipheral circuit IP0 can read an A/D conversion result beforecompletion of the A/D conversion for input signals supplied to all theinput channels. The method of using the selection signal SEL for thecompletion notification is available if the peripheral circuit IP0 isprovided with an interface portion for receiving the selection signalSEL. The circuit area increases less than the related art.

In the selection signal SEL, the bit signal SEL (CH2) for selecting theinput channel CH2 may be used to notify the peripheral circuit IP0 ofcompletion of the A/D conversion. In this case, the peripheral circuitIP0 acknowledges completion of the A/D conversion by detecting that thebit signal SEL (CH2) for selecting the input channel CH2 changes to theL level (to finish selecting the input channel CH2).

The embodiment notifies the peripheral circuit IP0 of completion of theA/D conversion on a signal input to the input channel CH2. In addition,the peripheral circuit IP0 may be notified of completion of the A/Dconversion on signals input to the input channels CH0 and CH1. In thiscase, the peripheral circuit IP0 can read the A/D conversion resultsfrom the data registers RA0 and RA1 immediately after completion of theA/D conversion on signals input to the input channels CH0 and CH1.

Modification of the First Embodiment

FIG. 3 is a block diagram showing a configuration of a microcontroller100A according to a modification of the first embodiment of theinvention. A conversion portion 2A shown in FIG. 3 differs from theconversion portion 2 shown in FIG. 1 in that the input channels CH0through CH2 include corresponding sample hold circuits SH0 through SH2(generically referred to as a sample hold circuit SH). The other pointsin FIG. 3 are equal to those shown in FIG. 1. Therefore, the same orequivalent parts are depicted by the same reference numerals and adescription is omitted for simplicity.

The sample hold circuit SH samples and holds a signal supplied to thecorresponding input channel CH. Signals incorporated into the samplehold circuits SH0 through SH2 are used to A/D convert signals suppliedto the input channels CH0 through CH2.

There may be a case where an input signal to the input channels CH0through CH2 temporally changes faster than the time required for the A/Dconversion. In such a case, a detection error increases if the samplehold circuit SH is not provided. As shown in FIG. 3, provision of thesample hold circuit SH can perform the A/D conversion on signals sampledat the same timing.

FIG. 4 is a timing chart showing operations of the microcontroller 100Ain FIG. 3. FIG. 4 shows operations of the conversion portion 2A when itreceives a scan conversion instruction from the CPU 1 or from any one ofthe peripheral circuits IP0 through IP2. FIG. 4 shows, from the top tothe bottom, a waveform (SEL (CH0)) of the bit signal in the selectionsignal for selecting the input channel CH0, an operation (A/D (CH0)) ofthe conversion portion 2A corresponding to an input signal to the inputchannel CH0, a waveform (SEL (CH1)) of the bit signal in the selectionsignal for selecting the input channel CH1, an operation (A/D (CH1)) ofthe conversion portion 2A corresponding to an input signal to the inputchannel CH1, a waveform (SEL (CH2)) of the bit signal in the selectionsignal for selecting the input channel CH2, and an operation (A/D (CH2))of the conversion portion 2A corresponding to an input signal to theinput channel CH2. FIG. 4 further shows waveforms of the bit signals inthe selection signal SEL for selecting the input channels CH3 throughCH5, a waveform of the completion notification signal CMP, andoperations (writing (W) or reading (R)) of the data registers RA0through RA5.

With reference to FIGS. 3 and 4, the conversion portion 2A startssampling signals input to the input channels CH0 through CH2 at time ts.At the next time th, the conversion portion 2A finishes sampling thesignals input to the input channels CH0 through CH2 and holds thesampled signals. The conversion portion 2A A/D converts the input signalheld in the sample hold circuit SH0 between time t1 and time t2. Theconversion portion 2A A/D converts the input signal held in the samplehold circuit SH1 between time t3 and time t4. The conversion portion 2AA/D converts the input signal held in the sample hold circuit SH2between time t5 and time t6. The other points in FIG. 4 are equal tothose shown in FIG. 2. Therefore, the same or equivalent parts aredepicted by the same reference numerals and a description is omitted forsimplicity.

Second Embodiment

FIG. 5 is a block diagram showing a configuration of a microcontroller100B according to a second embodiment of the invention.

The microcontroller 100B in FIG. 5 differs from the microcontroller 100in FIG. 1 in that the register group 13A in the conversion portion 2Bfurther includes flag registers RB0 through RB2 (also genericallyreferred to as a flag register RB) corresponding to the input channelsCH0 through CH2. In addition, the microcontroller 100B in FIG. 5 differsfrom the microcontroller in FIG. 1 in that part of the selection signalSEL is not output to the peripheral circuit IP0. The other points inFIG. 5 are equal to those shown in FIG. 1. Therefore, the same orequivalent parts are depicted by the same reference numerals and adescription is omitted for simplicity.

The peripheral circuit IP0 can read and write the contents in the flagregister RB through a dedicated line. The A/D converter 12 finishes A/Dconverting a signal input to any of the input channels CH0 through CH2and rewrites the corresponding flag register RB to “1” that representscompletion of the A/D conversion. The A/D converter 12 thereby notifiesthe peripheral circuit IP0 of completion of the A/D conversion. Theperipheral circuit IP0 reads an A/D conversion result stored in any ofthe data registers RA0 through RA2 and writes the flag register RBcorresponding to the data register RA back to “0” that representsincompletion of the A/D conversion. The peripheral circuit IP0 therebynotifies the conversion portion 2B of completion of data reading.

FIG. 6 is a timing chart showing operations of the microcontroller 100Bin FIG. 5. FIG. 6 shows operations when the conversion portion 2B inFIG. 5 receives a scan conversion instruction from the CPU 1 or any ofthe peripheral circuits IP0 through IP2. FIG. 6 shows, from the top tothe bottom, bit waveforms in the selection signal SEL for selecting theinput channels CH0 through CH5, a waveform of the completionnotification signal CMP, states (high level “1” and low level “0”) ofthe flag registers RB0 through RB2, and operations (writing (W) orreading (R)) of the data registers RA0 through RA5.

With reference to FIGS. 5 and 6, the conversion portion 2B selects theinput channel CH0 from time t1 to time t2 and writes an A/D conversionresult of the signal input to the input channel CH0 into the dataregister RA0. At time t2, the A/D converter 12 rewrites the flagregister RB0 to “1” in order to notify the peripheral circuit IP0 ofcompletion of the A/D conversion on the signal input to the inputchannel CH0.

From time t3 to time t4, the conversion portion 2B selects the inputchannel CH1 and writes an A/D conversion result of the signal input tothe input channel CH1 into the data register RA1. At time t4, the A/Dconverter 12 rewrites the flag register RB1 to “1” in order to notifythe peripheral circuit IP0 of completion of the A/D conversion on thesignal input to the input channel CH1.

From time t5 to time t6, the conversion portion 2B selects the inputchannel CH2 and writes an A/D conversion result of the signal input tothe input channel CH2 into the data register RA2. At time t6, the A/Dconverter 12 rewrites the flag register RB2 to “1” in order to notifythe peripheral circuit IP0 of completion of the A/D conversion on thesignal input to the input channel CH2.

From time t7 to time t9, the conversion portion 2B selects the inputchannel CH3 and writes an A/D conversion result of the signal input tothe input channel CH3 into the data register RA3. From time t10 to timet11, the conversion portion 2B selects the input channel CH4 and writesan A/D conversion result of the signal input to the input channel CH4into the data register RA4. From time t12 to time t13, the conversionportion 2B selects the input channel CH5 and writes an A/D conversionresult of the signal input to the input channel CH5 into the dataregister RA5.

The peripheral circuit IP0 reads data “1” from the flag registers RB0through RB2 and thereby acknowledges completion of the A/D conversion onthe signals input to the input channels CH0 through CH2. In response tothe result read from the flag register RB, the peripheral circuit IP0reads A/D conversion results stored in the data registers RA0 throughRA2 from time t8 to time t10. Upon completion of reading the A/Dconversion results at time t10, the peripheral circuit IP0 writes “0”into the flag registers RB0 through RB2 in order to notify the A/Dconverter of completion of the reading.

At time t14 after completion of the A/D conversion on the input signalsinput to all the input channels, the A/D converter 12 outputs thecompletion notification signal CMP indicating completion of the A/Dconversion to the interrupt control circuit 3. The CPU 1 receives aninterrupt control signal from the interrupt control circuit 3 andinstructs the DMA control circuit 4 to transfer A/D conversion results.At the next time t15, the DMA control circuit 4 starts transferring theA/D conversion results from the data registers RA3 through RA5 to theperipheral circuits IP1 and IP2.

As mentioned above, the microcontroller 100B according to the secondembodiment can acknowledge completion of the A/D conversion uponcompletion of the A/D conversion on signals input to the input channelsCH0 through CH2. The timing to read A/D conversion results can bespecified earlier than the related art.

According to the second embodiment, the A/D converter 12 can confirmthat the peripheral circuit IP0 reads A/D conversion results when theflag registers RB0 through RB2 are written back to “0.” It is possibleto prevent data from being overwritten before the peripheral circuit IP0reads an A/D conversion result. The first embodiment leaves thepossibility of overwriting because the A/D converter 12 does not confirmwhether the peripheral circuit IP0 reads an A/D conversion result. Thesecond embodiment improves this issue.

Similarly to the modification of the first embodiment, themicrocontroller 100B according to the second embodiment can be providedwith the sample hold circuits SH0 through SH2.

Third Embodiment

FIG. 7 is a block diagram showing a configuration of a microcontroller100C according to a third embodiment of the invention.

The microcontroller 100C in FIG. 7 differs from the microcontroller 100in FIG. 1 in that FIFO (First-In First-Out) buffer memory 6 is furtherincluded. In addition, the microcontroller 100C in FIG. 7 differs fromthe microcontroller 100 in FIG. 1 in that part of the selection signalSEL is not output to the peripheral circuit IP0. The other points inFIG. 7 are equal to those shown in FIG. 1. Therefore, the same orequivalent parts are depicted by the same reference numerals and adescription is omitted for simplicity.

The peripheral circuit IP0 can read data from the buffer memory 6through a dedicated line. The buffer memory 6 has such storage capacityas being capable of storing plural A/D conversion results for the inputchannels CH0 through CH2. Similarly to the normal FIFO, the buffermemory 6 includes an empty flag (EF) set to “1” if the memory is empty,a full flag (FF) set to “1” if the memory is full, and a write pointerand a read pointer indicating positions for writing and reading.

The A/D converter 12 notifies the peripheral circuit IP0 of completionof the A/D conversion by writing A/D conversion results of signals inputto the input channels CH0 through CH2 onto the data registers RA0through R2 and the buffer memory 6. The peripheral circuit IP0 detectscompletion of the A/D conversion by detecting the empty flag set to “0.”

FIG. 8 is a timing chart showing operations of the microcontroller 100Cin FIG. 7. FIG. 8 shows operations when the conversion portion 2receives a scan conversion instruction from the CPU 1 or any of theperipheral circuits IP0 through IP2. FIG. 8 shows, from the top to thebottom, bit waveforms in the selection signal SEL for selecting theinput channels CH0 through CH5, a waveform of the completionnotification signal CMP, states (high level “1” and low level “0”) ofthe empty flag provided for the buffer memory 6, contents of datawritten to the buffer memory 6, and contents of data read from thebuffer memory 6.

With reference to FIGS. 7 and 8, the conversion portion 2 selects theinput channel CH0 from time t1 to time t2 and writes an A/D conversionresult of the signal input to the input channel CH0 into the dataregister RA0. The conversion portion 2 writes an A/D conversion resultof the signal input to the input channel CH0 into the buffer memory 6between time t2 and time t4 after completion of the A/D conversion. Theempty flag provided for the buffer memory 6 changes from “1” to “0” whenwriting to the buffer memory 6 finishes at time t4.

The conversion portion 2 selects input channel CH1 from time t3 to timet5 and writes the A/D conversion result of a signal input to the inputchannel CH1 into the data register RA1. The conversion portion 2 writesan A/D conversion result of the signal input to the input channel CH1into the buffer memory 6 between time t5 and time t7 after completion ofthe A/D conversion.

The conversion portion 2 selects input channel CH2 from time t6 to timet8 and writes the A/D conversion result of a signal input to the inputchannel CH2 into the data register RA2. The conversion portion 2 writesan A/D conversion result of the signal input to the input channel CH2into the buffer memory 6 between time t8 and time t10 after completionof the A/D conversion.

From time t9 to time t11, the conversion portion 2 selects the inputchannel CH3 and writes an A/D conversion result of the signal input tothe input channel CH3 into the data register RA3. From time t12 to timet13, the conversion portion 2 selects the input channel CH4 and writesan A/D conversion result of the signal input to the input channel CH4into the data register RA4. From time t14 to time t15, the conversionportion 2 selects the input channel CH5 and writes an A/D conversionresult of the signal input to the input channel CH5 into the dataregister RA5.

The peripheral circuit IP0 periodically checks the empty flag anddetects it set to “0” to acknowledge completion of the A/D conversion ona signal input to any of the input channels CH0 through CH2. In responseto the detection result from the empty flag, the peripheral circuit IP0sequentially reads A/D conversion results stored in the data registersRA0 through RA2 between time t7 and time 11. The peripheral circuit IP0finishes reading A/D conversion results at time t11. At this point, theempty flag provided for the buffer memory 6 is configured to return to“1” from “0.” Alternatively, the peripheral circuit IP0 reconfigures theempty flag like this.

At time t16 after completion of the A/D conversion on input signals toall the input channels, the A/D converter 12 outputs the completionnotification signal CMP indicating completion of the A/D conversion tothe interrupt control circuit 3. The CPU 1 receives an interrupt controlsignal from the interrupt control circuit 3 and instructs the DMAcontrol circuit 4 to transfer A/D conversion results. The DMA controlcircuit 4 starts transferring the A/D conversion results from the dataregisters RA3 through RA5 to the peripheral circuits IP1 and IP2.

As mentioned above, the microcontroller 100C according to the thirdembodiment is provided with the FIFO buffer memory 6. For this reason,the peripheral circuit IP0 can acknowledge completion of the A/Dconversion when results of A/D conversion on signals input to the inputchannels CH0 through CH2 are written into the buffer memory 6. Thetiming to read A/D conversion results can be specified earlier than therelated art.

The microcontroller 100B according to the second embodiment isconfigured so that the A/D converter 12 confirms the contents of theflag registers RB0 through RB2. Accordingly, the A/D conversion mightstop if the peripheral circuit IP0 delays data processing for somereason. On the other hand, the microcontroller 100C according to thethird embodiment can write A/D conversion results until the buffermemory 6 becomes full. The microcontroller 100C reduces the possibilityof a delay in the A/D conversion even if the peripheral circuit IP0delays data processing for some reason.

The third embodiment has described the example of the FIFO buffer memory6 but is not limited thereto. The memory may be based on the addressingsystem. The memory may replace the above-mentioned buffer memory 6 ifthe peripheral circuit IP0 can detect A/D conversion results writteninto the memory using a flag register without using the CPU 1 and canread data written into the memory through a dedicated line without usingthe CPU 1.

Similarly to the modification of the first embodiment, themicrocontroller 100C according to the third embodiment can be providedwith the sample hold circuits SH0 through SH2.

All the disclosed embodiments just provide examples and must beconsidered to be nonrestrictive. The scope of the invention is definedby the appended claims, not the above description, and is intended toinclude meanings equivalent to the claims and all modifications withinthe claims.

What is claimed is:
 1. A semiconductor device comprising: a centralprocessing unit; a plurality of peripheral circuits including first andsecond peripheral circuits; and a conversion portion that has aplurality of input channels including one or more first channels and oneor more second channels, a channel selection portion for selecting oneof the input channels, and analog-to-digital (A/D) converter forconverting a signal input from a selected input channel and outputting aselection signal to the channel selection portion and a completionsignal, wherein signal processing in the first peripheral circuit usesan A/D conversion result on a signal input from the one or more firstchannels, wherein signal processing in the second peripheral circuituses an A/D conversion result on a signal input from the one or moresecond channels, wherein the conversion portion receives a scanconversion instruction from the central processing unit, sequentiallyselects a respective one of the input channels in accordance with aselection signal from the channel selection portion based on a specifiedselection order, and successively performs A/D conversion, and whereinwhen the conversion portion performs a scan conversion in response tothe scan conversion instruction, the first peripheral circuit receives aconversion result of the one or more first channels in response to theselection signal identified completion of A/D conversion and the secondperipheral circuit receives a conversion result of the one or moresecond channels in response to the selection signal identifiedcompletion of A/D conversion for all input channels.
 2. Thesemiconductor device according to claim 1, wherein the conversionportion notifies the first peripheral circuit of completion of A/Dconversion on a signal input to the one or more first channels withoutusing the central processing unit.
 3. The semiconductor device accordingto claim 2, wherein the conversion portion further includes a pluralityof data registers associated with the input channels, wherein each ofthe data registers stores an A/D conversion result of a signal input toa corresponding input channel, and wherein the first peripheral circuitis capable of reading, without using the central processing unit, A/Dconversion results stored in data registers corresponding to the one ormore first channels.
 4. The semiconductor device according to claim 2,wherein the conversion portion includes: a plurality of data registersthat are provided corresponding to the input channels and each store anA/D conversion result of a signal input from the selected input channel;and one or more flag registers corresponding to the one or more firstchannels, wherein the first peripheral circuit is capable of readingcontents of the one or more flag registers without using the centralprocessing unit, and wherein the A/D converter finishes A/D convertingsignals input to the one or more first channels, sets a correspondingflag register to a value indicating completion of A/D conversion, andthereby notifies the first peripheral circuit of completion of A/Dconversion.
 5. The semiconductor device according to claim 4, whereinthe first peripheral circuit is capable of reading, without using thecentral processing unit, A/D conversion results stored in one or moredata registers corresponding to the one or more first channels, andwherein the first peripheral circuit reads an A/D conversion resultstored in a data register corresponding to each of the one or more firstchannels and sets a corresponding flag register to a value indicatingincompletion of A/D conversion.
 6. The semiconductor device according toclaim 2, further comprising: buffer memory, wherein the first peripheralcircuit is capable of reading, without using the central processingunit, data stored in the buffer memory and is capable of detectingwhether the buffer memory stores data, and wherein the conversionportion writes an A/D conversion result of a signal input to each of theone or more first channels into the buffer memory and thereby notifiesthe first peripheral circuit of completion of A/D conversion.
 7. Thesemiconductor device according to claim 2, wherein the conversionportion includes one or more sample hold circuits for incorporating asignal input to each of the one or more first channels, and wherein theconversion portion A/D converts a signal incorporated into a sample holdcircuit corresponding to each of the one or more first channels.
 8. Thesemiconductor device according to claim 2, further comprising: aninterrupt control circuit that outputs an interrupt signal to thecentral processing unit in response to A/D conversion completionnotification received from the conversion portion when the conversionportion receives the scan conversion instruction and finishes A/Dconverting input signals input to all input channels.
 9. A motorcontrolling system comprising: a motor; a temperature sensor; and asemiconductor device, which comprises a plurality of terminals, ananalog-to-digital (A/D) conversion unit comprising a selection unit forselecting one terminal of the plurality of terminals to perform an A/Dconversion operation, a plurality of function units, and first pluralterminals used for coupling with the motor, and a second terminal usedfor coupling with the temperature sensor, wherein the A/D conversionunit converts a signal input from a selected input channel and outputs aselection signal to the selection unit and a completion signal, whereina first function unit of the plurality of function units is a centralprocessing unit for controlling the semiconductor device thereof,wherein a second function unit of the plurality of function units is adata processing unit for a conversion result of the motor, wherein athird function unit of the plurality of function units is a dataprocessing unit for a conversion result of the temperature sensor,wherein in response to receiving a first A/D conversion instruction fromthe central processing unit, the A/D conversion unit performs the A/Dconversion operation for a signal received from respective terminalscontinuously without an intervening instruction for specifying theterminal from the central processing unit, wherein the second functionunit starts a data processing in response to completion of the A/Dconversion operation for the first plural terminals without aninstruction from the central processing unit, and wherein the thirdfunction unit starts a data processing in response to a notificationfrom the central processing unit regarding with a completion of the A/Dconversion operation in accordance with the first A/D conversioninstruction.
 10. The motor controlling system according to claim 9,wherein the second function unit starts the data processing in responsethat the selection unit selects the second terminal after selecting thefirst plural terminals in the A/D conversion operation.
 11. The motorcontrolling system according to claim 10, wherein a number of the firstplural terminals is three, and the motor is three-phase synchronousmotor.